/* =====================================================================
 * roguelike.css  -  looks of the Roguelike screens
 * 🦆 Everything here starts with "rl-" so it can never change how the
 * existing menus or the battle screen look. "html.m" rules are the
 * phone layout (landscape phone), the rest is the PC layout.
 * ===================================================================== */

/* ---------- the big box ---------- */
#rl-root {
    display: none;
    position: fixed; inset: 0; z-index: 5000;
    flex-direction: column;
    background: radial-gradient(ellipse at 30% 20%, #241433 0%, #120c1a 55%, #0a0710 100%);
    color: #e5e7eb;
    font-family: 'Roboto', 'Noto Sans JP', sans-serif;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
#rl-root.rl-open { display: flex; }
#rl-root button { font-family: inherit; }
#rl-root .hidden { display: none !important; }

.rl-btn {
    background: #27212f; color: #e5e7eb; border: 1px solid #4b3d5c;
    padding: 9px 18px; border-radius: 6px; font-size: 0.95rem; cursor: pointer;
    transition: background .15s, border-color .15s, transform .1s;
}
.rl-btn:hover:not([disabled]) { border-color: #a855f7; background: #33283f; }
.rl-btn:active:not([disabled]) { transform: scale(0.97); }
.rl-btn[disabled] { opacity: .4; cursor: not-allowed; }
.rl-btn.rl-primary { background: linear-gradient(180deg, #8b2fd6, #6b21a8); border-color: #c084fc; font-weight: bold; }
.rl-btn.rl-primary:hover:not([disabled]) { background: linear-gradient(180deg, #9d3ff0, #7e22ce); }
.rl-muted { color: #9ca3af; }
.rl-small { font-size: 0.82rem; color: #a1a1aa; margin: 4px 0 0; }

/* ---------- top bar ---------- */
.rl-top {
    flex: 0 0 auto; display: flex; align-items: center; gap: 16px;
    padding: 8px 16px; background: rgba(8, 6, 12, 0.85); border-bottom: 1px solid #3b2a4d;
}
.rl-top-title { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.rl-top-title b { color: #c084fc; letter-spacing: 3px; font-size: 1.05rem; }
.rl-top-title span { color: #a1a1aa; font-size: 0.8rem; white-space: nowrap; }
.rl-inv {
    flex: 1 1 auto; display: flex; align-items: center; gap: 6px; min-width: 0; overflow-x: auto;
    background: rgba(255,255,255,0.04); border: 1px solid #2f2440; border-radius: 6px; padding: 4px 8px;
}
.rl-inv-label { color: #a1a1aa; font-size: 0.8rem; white-space: nowrap; margin-right: 4px; }
.rl-inv-empty { color: #52525b; font-size: 0.8rem; }
.rl-inv-item {
    width: 32px; height: 32px; flex: 0 0 auto; font-size: 1.15rem; line-height: 1;
    background: #1f1a27; border: 1px solid #6b21a8; border-radius: 6px; cursor: pointer; padding: 0;
}
.rl-res {
    flex: 1 1 auto; display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap;
}
.rl-res-item {
    background: rgba(255,255,255,0.05); border: 1px solid #3f3250; border-radius: 6px;
    padding: 4px 8px; font-size: 0.82rem; color: #d4d4d8; white-space: nowrap;
}
.rl-res-item b { color: #facc15; margin-left: 4px; }
.rl-res-hope b { color: #fb7185; }
.rl-cab-list { overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.rl-cab-empty { color: #a1a1aa; text-align: center; padding: 24px 8px; }
.rl-cab-row { display: flex; align-items: flex-start; gap: 10px; background: #1a1522; border: 1px solid #3f3250; border-radius: 8px; padding: 8px 10px; }
.rl-cab-ic { font-size: 1.6rem; line-height: 1; }
.rl-cab-main { display: flex; flex-direction: column; min-width: 0; }
.rl-cab-main b { color: #f5f3ff; }
.rl-cab-main small { color: #a1a1aa; }
.rl-soldout { color: #facc15; text-align: center; width: 100%; padding: 16px 8px; }
.rl-good.owned { display: none; }
.rl-good.poor { opacity: 0.85; }
.rl-top-btns { display: flex; gap: 6px; flex: 0 0 auto; }
.rl-top-btns button {
    background: #1f1a27; color: #e5e7eb; border: 1px solid #3f3250; border-radius: 6px;
    padding: 6px 10px; font-size: 0.85rem; cursor: pointer; white-space: nowrap;
}
.rl-top-btns button:hover { border-color: #a855f7; }
.rl-top-btns .rl-danger { color: #fca5a5; border-color: #7f1d1d; }

/* ---------- body ---------- */
.rl-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px 20px; display: flex; flex-direction: column; gap: 10px; }
.rl-body.rl-view-map { overflow: hidden; padding: 8px 12px; }
.rl-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.rl-head h2 { margin: 0; font-size: 1.5rem; color: #f5f3ff; }
.rl-head p { margin: 4px 0 0; color: #c4b5fd; font-size: 0.92rem; }
.rl-head-actions { display: flex; align-items: center; gap: 10px; }
.rl-count { font-size: 1.2rem; font-weight: bold; color: #facc15; }

/* ---------- character cards ---------- */
.rl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 10px; }
.rl-card {
    position: relative; display: flex; flex-direction: column; overflow: hidden;
    background: #1a1522; border: 2px solid #2f2440; border-radius: 8px; cursor: pointer;
    transition: border-color .15s, transform .15s, box-shadow .15s; user-select: none;
}
.rl-card:hover { border-color: #7e22ce; }
.rl-card.sel { border-color: #facc15; box-shadow: 0 0 14px rgba(250, 204, 21, 0.45); }
.rl-card.disabled { cursor: default; opacity: .55; filter: grayscale(.7); }
.rl-card-img { position: relative; height: 150px; overflow: hidden; background: linear-gradient(#2a2035, #15111c); }
.rl-card-img > img:not(.rl-duty-icon) { width: 100%; height: 100%; object-fit: cover; object-position: center 12%; pointer-events: none; }
.rl-duty-icon {
  position: absolute;
  left: 4px;
  bottom: 4px;
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(10,8,16,.72);
  border: 1px solid rgba(255,255,255,.25);
  box-shadow: 0 2px 6px rgba(0,0,0,.45);
  pointer-events: none;
  z-index: 2;
}
.rl-offer .rl-duty-icon { width: 40px; height: 40px; }
.rl-card-info { padding: 6px 8px 8px; display: flex; flex-direction: column; gap: 2px; }
.rl-card-info b { font-size: 0.98rem; }
.rl-card-info small { font-size: 0.68rem; color: #9ca3af; letter-spacing: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rl-card-badge {
    position: absolute; top: 6px; left: 6px; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px;
    background: #facc15; color: #1a1300; font-weight: bold; display: flex; align-items: center; justify-content: center;
}
.rl-card-prison {
    position: absolute; top: 0; left: 0; right: 0; text-align: center; padding: 4px 0;
    background: rgba(127, 29, 29, 0.85); color: #fecaca; font-weight: bold; font-size: 0.85rem;
}
.rl-card-status { padding: 0 8px 8px; font-size: 0.8rem; color: #d4d4d8; }
.rl-bearer-btn {
    position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border-radius: 50%;
    background: rgba(0,0,0,.7); border: 1px solid #facc15; font-size: 1rem; cursor: pointer; padding: 0;
}
.rl-hpbar { display: block; height: 6px; background: #3f3f46; border-radius: 3px; overflow: hidden; margin-top: 3px; }
.rl-hpbar i { display: block; height: 100%; }
.rl-hptext { font-size: 0.75rem; color: #d4d4d8; }
.rl-hptext em { color: #4ade80; font-style: normal; font-weight: bold; }
.rl-kit { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.rl-kit-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.rl-sk {
    position: relative; width: 100%; aspect-ratio: 1; border-radius: 5px; padding: 0;
    border: 1px solid color-mix(in srgb, var(--sk, #71717a) 70%, #000 30%);
    background: color-mix(in srgb, var(--sk, #71717a) 35%, #111 65%);
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    overflow: hidden;
}
.rl-sk img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.rl-sk i { font-style: normal; font-weight: 700; font-size: 0.72rem; color: #fafafa; pointer-events: none; }
.rl-sk.empty { background: rgba(255,255,255,0.04); border: 1px dashed #3f3f46; pointer-events: none; }
.rl-skill-tip {
    position: fixed; z-index: 80; max-width: 260px; min-width: 160px;
    background: #1c1428; border: 1px solid #7e22ce; border-radius: 8px;
    padding: 8px 10px; color: #f5f3ff; box-shadow: 0 8px 24px rgba(0,0,0,.45);
    pointer-events: none;
}
.rl-skill-tip.hidden { display: none; }
.rl-skill-tip h4 { margin: 0 0 4px; font-size: 0.9rem; color: #facc15; }
.rl-skill-tip p { margin: 0; font-size: 0.78rem; line-height: 1.35; color: #e4e4e7; white-space: pre-wrap; }

/* the 3 recruit choices */
.rl-offer { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; padding: 6px 0; }
.rl-offer .rl-card { width: 190px; }
.rl-offer .rl-card-img { height: 230px; }
.rl-itembox {
    display: flex; align-items: center; gap: 12px; align-self: center;
    background: rgba(107, 33, 168, 0.18); border: 1px solid #7e22ce; border-radius: 8px; padding: 8px 16px;
}
.rl-itembox-ic { font-size: 1.8rem; }
.rl-itembox b { display: block; }
.rl-itembox small { color: #c4b5fd; }

/* post-battle OR reward (3 tappable choices) */
.rl-reward {
    display: flex; justify-content: center; align-items: stretch; gap: 16px;
    flex-wrap: wrap; padding: 12px 0 4px;
}
.rl-reward-card {
    width: min(230px, 100%); min-height: 176px; box-sizing: border-box;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px; text-align: center;
    background: #1a1522; border: 2px solid #3f3250; border-radius: 10px;
    padding: 16px 14px; cursor: pointer; color: inherit; font-family: inherit;
    transition: border-color .15s, transform .15s, box-shadow .15s;
}
.rl-reward-card:hover:not([disabled]) {
    border-color: #a855f7; box-shadow: 0 0 14px rgba(168, 85, 247, 0.35);
}
.rl-reward-card:active:not([disabled]) { transform: scale(0.97); }
.rl-reward-card[disabled] { opacity: .45; cursor: not-allowed; filter: grayscale(.35); }
.rl-reward-ic { font-size: 2.4rem; line-height: 1; }
.rl-reward-card b { font-size: 1.08rem; color: #f5f3ff; }
.rl-reward-card small { color: #c4b5fd; font-size: 0.8rem; line-height: 1.35; }
.rl-reward-card.rl-reward-supplies { border-color: #854d0e; }
.rl-reward-card.rl-reward-supplies:hover:not([disabled]) {
    border-color: #facc15; box-shadow: 0 0 14px rgba(250, 204, 21, 0.35);
}

/* team strip */
.rl-teamstrip { display: flex; gap: 6px; overflow-x: auto; flex: 0 0 auto; padding: 4px 2px; }
.rl-chip {
    position: relative; flex: 0 0 auto; width: 74px; display: flex; flex-direction: column; align-items: center;
    background: #1a1522; border: 1px solid #2f2440; border-radius: 6px; padding: 4px; cursor: pointer;
}
.rl-chip img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; object-position: center 10%; background: #2a2035; }
.rl-chip-name { font-size: 0.68rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rl-chip-hp { width: 100%; height: 4px; background: #3f3f46; border-radius: 2px; overflow: hidden; }
.rl-chip-hp i { display: block; height: 100%; }
.rl-chip.prisoner { opacity: .6; border-color: #7f1d1d; }
.rl-chip.prisoner img { filter: grayscale(1); }
.rl-chip-lock { position: absolute; top: 2px; right: 4px; font-size: 0.8rem; }

/* ---------- route map ---------- */
.rl-mapview { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 6px; position: relative; }
.rl-map-hint { color: #a1a1aa; font-size: 0.85rem; flex: 0 0 auto; }
.rl-map-scroll {
    flex: 1 1 auto; min-height: 0; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch;
    background: linear-gradient(rgba(12,9,18,.82), rgba(12,9,18,.9)), url('../Art/background/Map1.webp') center / cover;
    border: 1px solid #2f2440; border-radius: 8px;
}
.rl-map-canvas { position: relative; }
.rl-lines { position: absolute; left: 0; top: 0; pointer-events: none; }
.rl-lines path { fill: none; stroke: #4b3d5c; stroke-width: 2.5; stroke-dasharray: 6 5; }
.rl-lines path.done { stroke: #a1a1aa; stroke-dasharray: none; stroke-width: 3; }
.rl-lines path.open { stroke: #facc15; stroke-dasharray: none; stroke-width: 3; filter: drop-shadow(0 0 4px rgba(250,204,21,.7)); }
.rl-col-label { position: absolute; top: 2px; text-align: center; font-size: 0.72rem; color: #6b5a7f; letter-spacing: 2px; text-transform: uppercase; }
.rl-start {
    position: absolute; width: 52px; height: 52px; border-radius: 50%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: #1f1a27; border: 2px solid #52525b; font-size: 1.1rem;
}
.rl-start small { font-size: 0.6rem; color: #a1a1aa; }
.rl-start.current { border-color: #22d3ee; box-shadow: 0 0 14px rgba(34, 211, 238, .6); }
.rl-node {
    position: absolute; display: flex; align-items: center; gap: 8px; padding: 6px 10px; box-sizing: border-box;
    background: linear-gradient(90deg, rgba(20,16,28,.96), rgba(32,25,44,.96));
    border: 2px solid #3f3250; border-left: 5px solid var(--nc); border-radius: 6px;
    cursor: pointer; overflow: hidden; user-select: none;
    transition: transform .15s, box-shadow .15s, border-color .15s, opacity .15s;
}
.rl-node-ic { font-size: 1.5rem; flex: 0 0 auto; position: relative; z-index: 1; }
.rl-node-tx { display: flex; flex-direction: column; min-width: 0; position: relative; z-index: 1; }
.rl-node-tx b { font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rl-node-tx small { font-size: 0.7rem; color: #a1a1aa; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rl-node-boss { position: absolute; right: -6px; top: -4px; height: 130%; opacity: .35; pointer-events: none; }
.rl-node-check { position: absolute; right: 6px; top: 4px; color: #4ade80; font-weight: bold; z-index: 1; }
.rl-node.locked { opacity: .45; cursor: default; }
.rl-node.done { opacity: .7; border-color: #52525b; }
.rl-node.current { opacity: 1; border-color: #22d3ee; box-shadow: 0 0 14px rgba(34, 211, 238, .55); }
.rl-node.selectable { border-color: #facc15; animation: rl-pulse 1.4s ease-in-out infinite; }
.rl-node.selectable:hover { transform: scale(1.05); }
.rl-node.focus { background: linear-gradient(90deg, rgba(66,45,10,.96), rgba(50,36,14,.96)); transform: scale(1.06); animation: none; box-shadow: 0 0 18px rgba(250, 204, 21, .8); }
@keyframes rl-pulse { 0%, 100% { box-shadow: 0 0 4px rgba(250,204,21,.35); } 50% { box-shadow: 0 0 16px rgba(250,204,21,.85); } }

.rl-node-info {
    position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 5;
    width: min(440px, 92%); background: rgba(14, 10, 20, 0.97); border: 1px solid var(--nc); border-radius: 8px;
    padding: 12px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.7);
}
.rl-ni-title { font-weight: bold; font-size: 1.1rem; margin-bottom: 4px; }
.rl-ni-body { font-size: 0.88rem; color: #d4d4d8; line-height: 1.45; }
.rl-ni-body small { color: #a1a1aa; }
.rl-ni-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

/* ---------- event / shop / rest panels ---------- */
.rl-panel-wrap {
    flex: 1 1 auto; display: flex; align-items: center; justify-content: center;
    background-size: cover; background-position: center; border-radius: 8px; padding: 12px;
}
.rl-panel {
    width: min(720px, 100%); background: rgba(14, 10, 20, 0.88); border: 1px solid #4b3d5c; border-radius: 10px;
    padding: 18px 22px; box-shadow: 0 20px 50px rgba(0,0,0,.6);
}
.rl-panel h2 { margin: 0 0 10px; }
.rl-flavor { font-size: 1.05rem; line-height: 1.6; color: #e9d5ff; }
.rl-placeholder { color: #fbbf24; font-size: 0.88rem; border: 1px dashed #92400e; border-radius: 6px; padding: 6px 10px; background: rgba(146, 64, 14, .15); }
.rl-panel-btns { display: flex; justify-content: center; gap: 10px; margin-top: 14px; }
/* ---------- Encounter (Arknights-style "unexpected encounter") ---------- */
.rl-body.rl-view-event { padding: 0; overflow: hidden; }
.rl-event {
    position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column;
    background-color: #07060b; background-size: 0 0; overflow: hidden;
}
/* 🦆 Blurred, darkened copy of the art fills the empty space around it. */
.rl-event::before {
    content: ''; position: absolute; inset: -30px; pointer-events: none;
    background-image: inherit; background-size: cover; background-position: center;
    filter: blur(22px) brightness(.32) saturate(.8);
}
/* 🦆 The real art: shown whole (contain), anchored to the right, full height. */
.rl-ev-art {
    position: absolute; top: 0; bottom: 0; right: 0; height: 100%; width: auto; max-width: 62%;
    object-fit: contain; object-position: right center; pointer-events: none;
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 12%);
            mask-image: linear-gradient(90deg, transparent 0%, #000 12%);
}
.rl-ev-shade {
    position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(90deg, rgba(6,5,10,.85) 0%, rgba(6,5,10,.55) 40%, rgba(6,5,10,0) 55%, rgba(6,5,10,0) 100%),
                linear-gradient(0deg, rgba(6,5,10,.75) 0%, rgba(6,5,10,0) 22%);
}
.rl-ev-main {
    position: relative; flex: 1 1 auto; min-height: 0; display: flex; gap: 28px;
    align-items: stretch; justify-content: space-between; padding: 22px 32px 10px;
}
.rl-ev-textbox { flex: 0 1 640px; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.rl-ev-kicker {
    display: inline-block; align-self: flex-start; font-size: 0.78rem; letter-spacing: 3px; text-transform: uppercase;
    color: #c4b5fd; border-left: 3px solid #a78bfa; padding: 2px 10px; background: rgba(167,139,250,.12);
}
.rl-ev-title { margin: 8px 0 10px; font-size: 1.9rem; letter-spacing: 1px; color: #f5f3ff; text-shadow: 0 2px 10px rgba(0,0,0,.8); }
.rl-ev-scroll {
    flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 14px 4px 0;
    font-size: 1rem; line-height: 1.7; color: #e7e5e4; text-shadow: 0 1px 3px rgba(0,0,0,.9);
}
.rl-ev-scroll p { margin: 0 0 10px; }
.rl-ev-scroll p:last-child { margin-bottom: 0; }
.rl-ev-picked { font-size: 0.82rem; color: #a1a1aa; margin-bottom: 4px; }
.rl-ev-outcome { margin: 0 0 8px; font-size: 1.25rem; color: #fde68a; }
.rl-ev-effect {
    margin-top: 12px; padding: 8px 12px; border-radius: 6px; font-size: 0.92rem; line-height: 1.5;
    background: rgba(250, 204, 21, .1); border: 1px solid rgba(250, 204, 21, .45); color: #fef3c7;
}
.rl-ev-effect > span { display: block; font-size: 0.72rem; letter-spacing: 2px; text-transform: uppercase; color: #facc15; margin-bottom: 2px; }
.rl-ev-choices {
    flex: 0 0 340px; display: flex; flex-direction: column; justify-content: center; gap: 12px; min-height: 0; overflow-y: auto;
}
.rl-ev-choice {
    display: flex; align-items: stretch; gap: 0; text-align: left; cursor: pointer; padding: 0;
    background: rgba(18, 14, 26, .88); color: #e5e7eb; border: 1px solid #5b4a70; border-left: 4px solid #a78bfa;
    border-radius: 4px 10px 10px 4px; box-shadow: 0 6px 20px rgba(0,0,0,.5);
    transition: transform .12s, border-color .15s, background .15s;
}
.rl-ev-choice:hover { transform: translateX(-4px); border-color: #c4b5fd; background: rgba(40, 28, 58, .92); }
.rl-ev-choice.rl-ev-locked, .rl-ev-choice.rl-ev-locked:hover {
    cursor: not-allowed; transform: none; opacity: .5; filter: grayscale(.8);
    border-color: #3f3a48; border-left-color: #52525b; background: rgba(18, 14, 26, .88);
}
.rl-ev-lock { font-style: normal; font-size: 0.75rem; color: #fca5a5; }
.rl-ev-choice:active { transform: scale(.98); }
.rl-ev-choice-no {
    flex: 0 0 34px; display: flex; align-items: center; justify-content: center;
    font-weight: bold; color: #c4b5fd; background: rgba(167,139,250,.15); font-size: 1.05rem;
}
.rl-ev-choice-tx { display: flex; flex-direction: column; gap: 4px; padding: 10px 14px; min-width: 0; }
.rl-ev-choice-tx b { font-size: 1.02rem; color: #f5f3ff; }
.rl-ev-choice-tx small { font-size: 0.8rem; line-height: 1.45; color: #c7c2cf; }
.rl-ev-continue { border-left-color: #facc15; justify-content: center; }
.rl-ev-continue .rl-ev-choice-tx { align-items: center; padding: 14px; }
.rl-ev-team { position: relative; padding: 0 32px 10px; }

/* Kaleidoscope drone marker on the battle map (drawn inside the entity layer) */
.rl-drone-mark {
    position: absolute; pointer-events: none; z-index: 13; box-sizing: border-box;
    border: 2px dashed #22d3ee; border-radius: 50%; box-shadow: 0 0 10px rgba(34, 211, 238, .7);
    animation: rl-drone-pulse 1.6s ease-in-out infinite;
}
.rl-drone-mark span { position: absolute; top: -8px; left: -8px; font-size: 14px; filter: drop-shadow(0 0 2px #000); }
@keyframes rl-drone-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

.rl-goods { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.rl-good {
    width: 180px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
    background: #1a1522; border: 1px solid #3f3250; border-radius: 8px; padding: 10px;
}
.rl-good-ic { font-size: 2rem; }
.rl-good small { color: #a1a1aa; font-size: 0.72rem; }
.rl-price { color: #facc15; font-weight: bold; }
.rl-rest-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.rl-rest-row { display: grid; grid-template-columns: 30px 1fr; grid-template-rows: auto auto auto; column-gap: 8px; align-items: center; background: #1a1522; border-radius: 6px; padding: 5px 8px; }
.rl-rest-row img { grid-row: span 3; width: 30px; height: 30px; border-radius: 50%; object-fit: cover; object-position: center 10%; }
.rl-rest-row.prisoner { opacity: .55; }

/* ---------- results ---------- */
.rl-result { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.rl-result h1 { margin: 4px 0 0; font-size: 2.4rem; letter-spacing: 6px; }
.rl-result.win h1 { color: #4ade80; text-shadow: 0 0 20px rgba(74, 222, 128, .5); }
.rl-result.lose h1 { color: #f87171; text-shadow: 0 0 20px rgba(248, 113, 113, .5); }
.rl-result-reason { margin: 0; color: #d4d4d8; }
.rl-stats { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.rl-stats div { background: #1a1522; border: 1px solid #3f3250; border-radius: 8px; padding: 6px 16px; text-align: center; min-width: 90px; }
.rl-stats small { display: block; color: #a1a1aa; font-size: 0.75rem; }
.rl-stats b { font-size: 1.3rem; color: #facc15; }
.rl-route { margin: 0; font-size: 1.1rem; }
.rl-grid-result { width: 100%; }
.rl-grid-result .rl-card { cursor: default; }
.rl-grid-result .rl-card-img { height: 110px; }

/* ---------- team pop-up ---------- */
.rl-modal { position: absolute; inset: 0; z-index: 20; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; padding: 10px; }
.rl-modal-box { width: min(720px, 100%); max-height: 100%; display: flex; flex-direction: column; background: #15101c; border: 1px solid #6b21a8; border-radius: 10px; overflow: hidden; }
.rl-modal-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; background: #1f1729; }
.rl-modal-head h3 { margin: 0; }
.rl-team-list { overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.rl-team-row { display: flex; align-items: center; gap: 10px; background: #1a1522; border-radius: 6px; padding: 6px 10px; }
.rl-team-row img.rl-team-portrait { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; object-position: center 10%; }
.rl-team-duty { width: 16px; height: 16px; object-fit: contain; vertical-align: -2px; margin-right: 4px; border-radius: 3px; }
.rl-team-main b { display: flex; align-items: center; gap: 0; }
.rl-team-row.prisoner img { filter: grayscale(1); }
.rl-team-main { display: flex; flex-direction: column; width: 140px; }
.rl-team-main small { color: #9ca3af; font-size: 0.7rem; }
.rl-team-hp { flex: 1 1 auto; }
.rl-tag { font-size: 0.78rem; padding: 3px 8px; border-radius: 10px; white-space: nowrap; }
.rl-tag.ok { background: rgba(34,197,94,.15); color: #86efac; border: 1px solid #166534; }
.rl-tag.prisoner { background: rgba(127,29,29,.35); color: #fecaca; border: 1px solid #7f1d1d; }

.rl-toast {
    position: absolute; left: 50%; bottom: 20px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
    background: rgba(20, 15, 28, .97); border: 1px solid #a855f7; border-radius: 8px; padding: 8px 14px;
    font-size: 0.9rem; z-index: 30; transition: opacity .2s, transform .2s; max-width: 90%; text-align: center;
}
.rl-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* main menu entry button: a gold edge so it stands out */
#menu-main > button.rl-menu-btn { border-right-color: #facc15; }
/* in-battle retreat button (inside the settings window) */
.rl-retreat-btn { border-color: #7f1d1d !important; color: #fca5a5 !important; }
#rl-end-note { margin: 6px 0 12px; font-weight: bold; }

/* =====================================================================
 * Phone layout (landscape, about 844 x 390)
 * ===================================================================== */
html.m #menu-main > button { min-height: 44px; }
html.m #menu-main { gap: 6px; }

html.m .rl-top { gap: 8px; padding: 4px 8px; }
html.m .rl-top-title b { font-size: 0.85rem; letter-spacing: 1px; }
html.m .rl-top-title span { font-size: 0.68rem; }
html.m .rl-inv { padding: 2px 6px; }
html.m .rl-inv-label { font-size: 0.7rem; }
html.m .rl-inv-item { width: 28px; height: 28px; font-size: 1rem; }
html.m .rl-top { flex-wrap: wrap; }
html.m .rl-res { order: 3; width: 100%; gap: 6px; }
html.m .rl-res-item { font-size: 0.7rem; padding: 3px 6px; }
html.m .rl-top-btns button { padding: 6px 8px; font-size: 0.75rem; }
html.m .rl-body { padding: 6px 10px; gap: 6px; }
html.m .rl-body.rl-view-map { padding: 4px 8px; }
html.m .rl-head { gap: 8px; align-items: center; }
html.m .rl-head h2 { font-size: 1.05rem; }
html.m .rl-head p { font-size: 0.75rem; margin-top: 2px; }
html.m .rl-small { font-size: 0.7rem; }
html.m .rl-btn { padding: 8px 14px; font-size: 0.85rem; }
html.m .rl-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
html.m .rl-kit { gap: 3px; margin-top: 4px; }
html.m .rl-kit-row { gap: 3px; }
html.m .rl-sk i { font-size: 0.62rem; }
html.m .rl-card-img { height: 82px; }
html.m .rl-duty-icon { width: 26px; height: 26px; left: 3px; bottom: 3px; border-radius: 6px; }
html.m .rl-card-info { padding: 3px 6px 5px; }
html.m .rl-card-info b { font-size: 0.82rem; }
html.m .rl-card-info small { font-size: 0.58rem; }
html.m .rl-card-badge { min-width: 22px; height: 22px; font-size: 0.8rem; top: 4px; left: 4px; }
html.m .rl-offer { gap: 10px; padding: 0; }
html.m .rl-offer .rl-card { width: 132px; }
html.m .rl-offer .rl-card-img { height: 120px; }
html.m .rl-itembox { padding: 4px 10px; }
html.m .rl-itembox-ic { font-size: 1.3rem; }
html.m .rl-itembox b { font-size: 0.8rem; }
html.m .rl-itembox small { font-size: 0.7rem; }
html.m .rl-reward { gap: 8px; padding: 4px 0; }
html.m .rl-reward-card { width: 150px; min-height: 128px; padding: 8px; gap: 5px; }
html.m .rl-reward-ic { font-size: 1.7rem; }
html.m .rl-reward-card b { font-size: 0.88rem; }
html.m .rl-reward-card small { font-size: 0.68rem; }
html.m .rl-chip { width: 58px; padding: 2px; }
html.m .rl-chip img { width: 30px; height: 30px; }
html.m .rl-chip-name { font-size: 0.6rem; }
html.m .rl-map-hint { font-size: 0.7rem; }
html.m .rl-node { padding: 4px 6px; gap: 5px; border-left-width: 4px; }
html.m .rl-node-ic { font-size: 1.1rem; }
html.m .rl-node-tx b { font-size: 0.78rem; }
html.m .rl-node-tx small { font-size: 0.6rem; }
html.m .rl-col-label { font-size: 0.6rem; }
html.m .rl-node-info { bottom: 64px; padding: 8px 10px; }
html.m .rl-ni-title { font-size: 0.95rem; }
html.m .rl-ni-body { font-size: 0.75rem; line-height: 1.35; }
html.m .rl-ni-btns { margin-top: 6px; }
html.m .rl-panel-wrap { padding: 4px; align-items: flex-start; }
html.m .rl-panel { padding: 10px 14px; }
html.m .rl-panel h2 { font-size: 1.1rem; margin-bottom: 6px; }
html.m .rl-flavor { font-size: 0.85rem; line-height: 1.45; margin: 4px 0; }
html.m .rl-placeholder { font-size: 0.72rem; margin: 6px 0; }
html.m .rl-panel-btns { margin-top: 8px; }
html.m .rl-ev-main { flex-direction: column; gap: 6px; padding: 6px 10px 4px; padding-right: calc(40% + 4px); }
/* 🦆 Phone: whole art on the right 40%, text + choices on the left. */
html.m .rl-ev-art { max-width: 40%; -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 8%); mask-image: linear-gradient(90deg, transparent 0%, #000 8%); }
html.m .rl-ev-shade { background: linear-gradient(90deg, rgba(6,5,10,.9) 0%, rgba(6,5,10,.8) 58%, rgba(6,5,10,0) 64%); }
html.m .rl-ev-textbox { flex: 1 1 auto; }
html.m .rl-ev-kicker { font-size: 0.62rem; letter-spacing: 2px; padding: 1px 6px; }
html.m .rl-ev-title { font-size: 1.1rem; margin: 3px 0 4px; }
html.m .rl-ev-scroll { font-size: 0.8rem; line-height: 1.45; padding-right: 6px; }
html.m .rl-ev-scroll p { margin-bottom: 6px; }
html.m .rl-ev-outcome { font-size: 0.95rem; margin-bottom: 4px; }
html.m .rl-ev-effect { margin-top: 6px; padding: 5px 8px; font-size: 0.76rem; }
html.m .rl-ev-choices { flex: 0 0 auto; flex-direction: row; gap: 6px; overflow: visible; }
html.m .rl-ev-choice { flex: 1 1 0; min-width: 0; min-height: 44px; }
html.m .rl-ev-choice:hover { transform: none; }
html.m .rl-ev-lock { font-size: 0.62rem; }
html.m .rl-ev-choice-no { flex-basis: 24px; font-size: 0.85rem; }
html.m .rl-ev-choice-tx { padding: 5px 8px; gap: 2px; }
html.m .rl-ev-choice-tx b { font-size: 0.82rem; }
html.m .rl-ev-choice-tx small { font-size: 0.64rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
html.m .rl-ev-continue .rl-ev-choice-tx { padding: 8px; }
html.m .rl-ev-team { display: none; }
html.m .rl-good { width: 150px; padding: 6px; }
html.m .rl-good-ic { font-size: 1.4rem; }
html.m .rl-rest-list { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px; }
html.m .rl-rest-row { padding: 3px 6px; font-size: 0.75rem; }
html.m .rl-result h1 { font-size: 1.5rem; letter-spacing: 3px; margin: 0; }
html.m .rl-result { gap: 4px; }
html.m .rl-result-reason { font-size: 0.8rem; }
html.m .rl-stats { gap: 6px; }
html.m .rl-stats div { padding: 3px 10px; min-width: 70px; }
html.m .rl-stats b { font-size: 1rem; }
html.m .rl-route { font-size: 0.85rem; }
html.m .rl-grid-result .rl-card-img { height: 64px; }
html.m .rl-team-row { padding: 4px 8px; gap: 8px; }
html.m .rl-team-row img.rl-team-portrait { width: 30px; height: 30px; }
html.m .rl-team-duty { width: 14px; height: 14px; }
html.m .rl-team-main { width: 100px; }
html.m .rl-tag { font-size: 0.65rem; }
/* phone in portrait: the game already asks to rotate; hide our box below that notice */

/* ===== 🦆 Shop: Arknights-style store (owner left, 3x2 shelf right) ===== */
.rl-shop {
    position: relative; flex: 1 1 auto; min-height: 0; display: flex; overflow: hidden;
    background-color: #07060b; background-size: 0 0;
}
.rl-shop::before {
    content: ''; position: absolute; inset: -30px; pointer-events: none;
    background-image: inherit; background-size: cover; background-position: center;
    filter: blur(14px) brightness(.35) saturate(.85);
}
.rl-sh-owner { position: relative; flex: 0 0 38%; min-width: 0; display: flex; align-items: flex-end; justify-content: center; }
.rl-sh-owner img {
    position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
    height: 100%; width: auto; max-width: 100%; object-fit: contain; object-position: bottom center;
    filter: drop-shadow(0 0 18px rgba(0,0,0,.7)); pointer-events: none;
}
.rl-sh-bubble {
    position: absolute; left: 6%; right: 6%; bottom: 18px; z-index: 1;
    padding: 10px 14px; border-radius: 8px; border-left: 4px solid #facc15;
    background: rgba(12, 10, 18, .86); color: #f5f3ff; font-size: .9rem; line-height: 1.5;
    box-shadow: 0 6px 20px rgba(0,0,0,.5);
}
.rl-sh-main {
    position: relative; flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 10px;
    padding: 18px 28px 14px 8px;
}
.rl-sh-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.rl-sh-title { margin: 6px 0 0; font-size: 1.6rem; color: #f5f3ff; text-shadow: 0 2px 10px rgba(0,0,0,.8); }
.rl-sh-wallet {
    display: flex; align-items: baseline; gap: 6px; padding: 6px 14px; border-radius: 6px;
    background: rgba(0,0,0,.55); border: 1px solid rgba(250,204,21,.5); font-size: 1.1rem;
}
.rl-sh-wallet b { font-size: 1.5rem; color: #fde68a; }
.rl-sh-wallet small { color: #a1a1aa; font-size: .75rem; }
.rl-sh-grid { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); gap: 10px; }
.rl-sh-card {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    min-height: 0; padding: 10px 8px 36px; border-radius: 6px; cursor: pointer; overflow: hidden;
    background: linear-gradient(180deg, rgba(40,36,52,.9), rgba(18,16,26,.95));
    border: 1px solid rgba(255,255,255,.14); color: #f5f3ff; font: inherit;
    transition: transform .12s, border-color .12s;
}
.rl-sh-card:hover { transform: translateY(-3px); border-color: #c4b5fd; }
.rl-sh-card.sel { border-color: #facc15; box-shadow: 0 0 0 2px rgba(250,204,21,.6), 0 0 18px rgba(250,204,21,.25); }
.rl-sh-card.empty { background: rgba(0,0,0,.3); border-style: dashed; cursor: default; }
.rl-sh-ic { font-size: 2.6rem; line-height: 1; }
.rl-sh-name { font-size: .92rem; font-weight: bold; text-align: center; }
.rl-sh-price {
    position: absolute; left: 0; right: 0; bottom: 0; padding: 5px; text-align: center;
    background: rgba(0,0,0,.65); color: #fde68a; font-weight: bold;
}
.rl-sh-card.poor .rl-sh-price { color: #f87171; }
.rl-sh-card.sold { cursor: default; }
.rl-sh-card.sold > :not(.rl-sh-stamp) { opacity: .3; }
.rl-sh-stamp {
    position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%) rotate(-14deg);
    padding: 2px 14px; border: 3px solid #f87171; border-radius: 4px; color: #f87171;
    font-size: 1.3rem; font-weight: 900; letter-spacing: 3px; background: rgba(0,0,0,.4);
}
.rl-sh-detail {
    display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 8px 12px; border-radius: 6px;
    background: rgba(0,0,0,.6); border: 1px solid rgba(255,255,255,.12);
}
.rl-sh-hint { color: #a1a1aa; justify-content: center; font-size: .9rem; }
.rl-sh-dic { font-size: 2rem; }
.rl-sh-dtx { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.rl-sh-dtx small { color: #c7c2cf; font-size: .82rem; line-height: 1.4; }
.rl-sh-detail .rl-btn { flex: 0 0 auto; }
.rl-sh-foot { display: flex; justify-content: flex-end; gap: 10px; }

html.m .rl-sh-owner { flex-basis: 30%; }
html.m .rl-sh-bubble { left: 2px; right: 2px; bottom: 4px; padding: 4px 6px; font-size: .62rem; line-height: 1.3; border-left-width: 3px; }
html.m .rl-sh-main { gap: 5px; padding: 6px 10px 6px 4px; }
html.m .rl-sh-title { font-size: 1rem; margin-top: 2px; }
html.m .rl-sh-wallet { padding: 2px 8px; font-size: .85rem; }
html.m .rl-sh-wallet b { font-size: 1rem; }
html.m .rl-sh-grid { gap: 5px; }
html.m .rl-sh-card { padding: 4px 4px 22px; gap: 2px; }
html.m .rl-sh-ic { font-size: 1.5rem; }
html.m .rl-sh-name { font-size: .7rem; }
html.m .rl-sh-price { padding: 2px; font-size: .72rem; }
html.m .rl-sh-stamp { font-size: .85rem; border-width: 2px; padding: 0 8px; }
html.m .rl-sh-detail { min-height: 40px; padding: 4px 8px; gap: 6px; }
html.m .rl-sh-dic { font-size: 1.3rem; }
html.m .rl-sh-dtx b { font-size: .8rem; }
html.m .rl-sh-dtx small { font-size: .66rem; }
html.m .rl-sh-hint { font-size: .72rem; }
html.m .rl-sh-detail .rl-btn, html.m .rl-sh-foot .rl-btn { padding: 4px 10px; font-size: .75rem; min-height: 32px; }

/* 🦆 Collection pictures (fall back to emoji when a collection has none). */
.rl-col-img { width: 1.6em; height: 1.6em; object-fit: contain; vertical-align: middle; }
.rl-sh-ic .rl-col-img { width: 96px; height: 96px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.6)); }
.rl-sh-dic .rl-col-img { width: 52px; height: 52px; }
.rl-reward-ic .rl-col-img, .rl-cab-ic .rl-col-img { width: 1.3em; height: 1.3em; }
html.m .rl-sh-ic .rl-col-img { width: 44px; height: 44px; }
html.m .rl-sh-dic .rl-col-img { width: 32px; height: 32px; }
